<template>
	<view class="combo-detail">
		<u-tabs :list="list" :is-scroll="false" :current="current" :active-color='themeColorLight' @change="change"></u-tabs>
		<view class="div-cut"></view>
		<view v-show="current===1">
			<view class="reminder">
				<view class="reminder-title">
					检前须知
				</view>
				<view class="reminder-content">
					请提前预约，错开检查高峰
				</view>
			</view>
			<view class="reminder">
				<view class="reminder-title">
					检查须知
				</view>
				<view class="reminder-content">
					部分项目可能需要空腹,请做好准备
				</view>
			</view>
			<view class="reminder">
				<view class="reminder-title">
					体检地址
				</view>
				<view class="reminder-content">
					{{hospitalInfo.address}}
				</view>
			</view>
		</view>
		<view class="combo-detail-main" v-show="current===0">
			<u-row>
				<u-col span="8">
					<view class="table-th">项目名</view>
				</u-col>
				<u-col span="4">
					<view class="table-th">金额(元)</view>
				</u-col>
			</u-row>
			<view class="tbody">
				<u-row v-for="(item, i) in dataList" :key='i'>
					<u-col span="8">
						<view class="table-tr">{{item.payItemName}}</view>
					</u-col>
					<u-col span="4">
						<view class="table-tr" style="color: #FBAE70">{{item.money}}</view>
					</u-col>
				</u-row>
			</view>
		</view>
		<view class="combo-detail-btn grad-home-register" @click="toPage" v-show="current===0">
			去预约
		</view>
		<Load :load="load" />
	</view>
</template>

<script>
	import Load from '@/components/Load/index.vue'
	import { getComboDetail } from '@/api/physical.js'
	import { themeColorLight } from '@/static/js/theme.js'
	import { mapGetters } from 'vuex'
	export default {
		components:{ Load },
		data() {
			return {
				themeColorLight,
				load:false,
				comboId:null,
				dataList:[],
				list:[{name:'套餐内容'},{name:'检查须知'}],
				current:0,
				routeParams:''
			}
		},
		computed:{
			...mapGetters(['hospitalInfo'])
		},
		onLoad(op) {
			this.comboId = op.comboId||''
			this.routeParams = op.data?JSON.parse(op.data):''
			this.initData()
		},
		methods: {
			change(val){
				this.current = val
			},
			initData(){
				this.load = true
				getComboDetail({comboId:this.comboId}).then(data => {
					this.load = false
					this.dataList = data||[]
				}).catch(e => {
					this.load = false
					this.dataList = []
				})
			},
			toPage(){
				let res = {
					...this.routeParams,
					comboId: this.comboId
				}
				uni.navigateTo({
					url:'/physical/PhysicalServe/checkIn?data=' + JSON.stringify(res)
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.combo-detail{
		height: 100%;
		background-color: #fff;
		&-main{
			// max-height: calc(100vh - 130rpx);
			// overflow: scroll;
			padding: 30rpx;
			.table-th{
				height: 90rpx;
				line-height: 90rpx;
				text-align: center;
				font-size: 30rpx;
				font-weight: bold;
			}
			.tbody{
				margin-top: 10rpx;
				max-height: calc(100vh - 230rpx - 80rpx - 70rpx);
				overflow: scroll;
			}
			.table-tr{
				padding: 10rpx 20rpx;
				font-size: 26rpx;
				text-align: center;
			}
		}
		&-btn{
			margin: 20rpx 30rpx;
			height: 90rpx;
			color: #FFF;
			border-radius: 12rpx;
			line-height: 90rpx;
			text-align: center;
		}
	}
</style>
<style>
	.u-col{
		padding: 0 !important;
	}
</style>